Imports System.IO


Public Class clsFileGnrt


  Public Sub File_Generate(ByVal lFile_Text As String _
                         , ByVal lMain_Clas_Name As String _
                         , ByVal aStrFolderName As String)

    mPrCreateFolder(aStrFolderName)

    Dim mfile_strm As New FileStream("C:\" & aStrFolderName & "\" & lMain_Clas_Name & ".vb", FileMode.Create, FileAccess.Write)
    Dim sStr As New StreamWriter(mfile_strm)
    sStr.BaseStream.Seek(0, SeekOrigin.End)
    sStr.WriteLine(lFile_Text)
    sStr.Close()

  End Sub


  Public Sub mprProCFileGenerate(ByVal lFile_Text As String _
                         , ByVal lMain_Clas_Name As String _
                         , ByVal aStrFolderName As String)

    mPrCreateFolder(aStrFolderName)

    Dim mfile_strm As New FileStream("C:\" & aStrFolderName & "\" & lMain_Clas_Name & ".h", FileMode.Create, FileAccess.Write)
    Dim sStr As New StreamWriter(mfile_strm)
    sStr.BaseStream.Seek(0, SeekOrigin.End)
    sStr.WriteLine(lFile_Text)
    sStr.Close()

    End Sub

    Public Sub mprProCBodyFileGenerate(ByVal lFile_Text As String _
                         , ByVal lMain_Clas_Name As String _
                         , ByVal aStrFolderName As String)

        mPrCreateFolder(aStrFolderName)

        Dim mfile_strm As New FileStream("C:\" & aStrFolderName & "\" & lMain_Clas_Name & ".pc", FileMode.Create, FileAccess.Write)
        Dim sStr As New StreamWriter(mfile_strm)
        sStr.BaseStream.Seek(0, SeekOrigin.End)
        sStr.WriteLine(lFile_Text)
        sStr.Close()

    End Sub



  Public Sub mPrCreateFolder(ByVal aStrFolderName As String)

    If Directory.Exists("C:\" & aStrFolderName) = False Then
      Directory.CreateDirectory("C:\" & aStrFolderName)
    End If

  End Sub


  Public Sub mPrGnrtSQLCEScriptFile(ByVal aStrFileText As String, ByVal aStrFileName As String)

    'Dim lStrFileName As String = "SQlCEScriptFile.sql"
    Dim lFileStream As FileStream
    Dim lStreamWriter As StreamWriter

    mPrCreateFolder("SQLCE Script")

    If File.Exists("C:\SQLCE Script\" & aStrFileName) = False Then
      lFileStream = New FileStream("C:\SQLCE Script\" & aStrFileName & ".sql", FileMode.Create, FileAccess.Write)

      lStreamWriter = New StreamWriter(lFileStream)
      lStreamWriter.BaseStream.Seek(0, SeekOrigin.End)
      lStreamWriter.WriteLine(aStrFileText)
      lStreamWriter.Close()
    End If

  End Sub



  Public Sub mPrGnrtOracleScriptFile(ByVal aStrFileText As String, ByVal aStrFileName As String)

    Dim lFileStream As FileStream
    Dim lStreamWriter As StreamWriter

    mPrCreateFolder("ORACLE Script")

    If File.Exists("C:\ORACLE Script\" & aStrFileName) = False Then
      lFileStream = New FileStream("C:\ORACLE Script\" & aStrFileName & ".sql", FileMode.Create, FileAccess.Write)

      lStreamWriter = New StreamWriter(lFileStream)
      lStreamWriter.BaseStream.Seek(0, SeekOrigin.End)
      lStreamWriter.WriteLine(aStrFileText)
      lStreamWriter.Close()
    End If

  End Sub


End Class
